<template>
  <div>
    <canvas ref="canvas" />
    <button @click="btn">生成头像二维码</button>
  </div>
</template>

<script>
import Qrcode from 'qrcode'
export default {
  methods: {
    btn() {
      Qrcode.toCanvas(
        this.$refs.canvas,
        'https://wyh-1310134769.cos.ap-guangzhou.myqcloud.com/1.jpg',
        {
          // 二维码的配制，常用配制，宽与高之类
          width: 350,
          height: 350
        }
      )
    }
  }
}
</script>

<style></style>
